// 源插件
import React, { PureComponent } from 'react';
import { connect } from 'dva';
// 视图插件
import { Form, Input, Modal, Select } from 'antd';
// 外部组件

// css OR less预编译器

// 图片

const FormItem = Form.Item;
const InputGroup = Input.Group;
/**
 *  Created by xjc on 2019/8/15
 *  Describe:数据连接
 */

@connect(({ positionrui, loading }) => ({
  positionrui,
  loading: loading.models.positionruiRule,
}))
@Form.create()
class PositionRuiStockSourceAddDetail extends PureComponent {
  componentWillMount() {}

  /**
   *  Created by xjc on 2019/8/15
   *  Describe:当前状态
   */

  state = {};

  onChange = e => {};

  okHandle() {
    this.props.form.validateFields((err, values) => {
      if (!err) {
        const { dispatch } = this.props;
        dispatch({
          type: 'positionrui/AddPositionSource',
          payload: {
            sourceperson: values.sourceperson,
            stock: values.stock,
          },
          callback: () => {
            this.props.closeRecord();
          },
        });
      }
    });
  }

  cancelHandle() {
    this.props.closeRecord();
  }

  render() {
    const {} = this.state;
    const { record, form, OptionDetailVisible } = this.props;
    const { getFieldDecorator } = form;

    return (
      <Modal
        destroyOnClose
        title="条目添加"
        visible={OptionDetailVisible}
        centered
        onOk={this.okHandle.bind(this)}
        onCancel={this.cancelHandle.bind(this)}
      >
        <Form onSubmit={this.handleSearch}>
          <FormItem label="股票" labelCol={{ span: 8 }} wrapperCol={{ span: 15 }}>
            {getFieldDecorator('stock', { initialValue: '' })(
              <Input style={{ width: '85%' }} placeholder="股票" />
            )}
          </FormItem>

          <FormItem label="归属人" labelCol={{ span: 8 }} wrapperCol={{ span: 15 }}>
            {getFieldDecorator('sourceperson', { initialValue: '' })(
              <Select style={{ width: '85%' }}>
                <Option value="金融团队管理">金融团队管理</Option>
                <Option value="傅总管理">傅总管理</Option>
                <Option value="郭老师管理">郭老师管理</Option>
                {/* <Option value="卖掉">卖掉</Option> */}
              </Select>
            )}
          </FormItem>
        </Form>
      </Modal>
    );
  }

  componentDidMount() {}

  componentWillUnmount() {}
}

export default PositionRuiStockSourceAddDetail;
